﻿@using Lib.core;
@using Lib.helper;

@using Bll;
@using Model;
@using Lib.model;
@{
    Layout = null;

    List<FileModel> list = ViewData["list"] as List<FileModel>;
    string parent = ConvertHelper.GetString(ViewData["parent"]);
}

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- header page -->
    @Html.Partial(IncludePath("header"))
</head>

<body>
    @Html.Partial(IncludePath("body_top"))
    @Html.Partial(IncludePath("manage_nav"))


    <div class="container">

        <div class="row">
            <div class="col-md-12">
                <div class="box right">
                    <a href="/admin/file/fileexplorer/" class="btn btn-primary" target="_self">根目录</a>
                    @if (ValidateHelper.IsPlumpString(parent))
                    {
                        <a href="/admin/file/fileexplorer/?path=@(parent)" class="btn btn-primary" target="_self">上一级</a>
                    }
                </div>
            </div>
            <div class="col-md-12">
                <div class="box">
                    @if (ValidateHelper.IsPlumpList(list))
                    {
                        <table class="table table-responsive">
                            <thead>
                                <tr>
                                    <td>文件名</td>
                                    <td>读取时间</td>
                                    <td>创建时间</td>
                                    <td>文件大小</td>
                                    <td>操作</td>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (FileModel file in list)
                                {
                                    <tr>
                                        <td>
                                            @if (file.IsDir)
                                            {
                                                <a href="/admin/file/fileexplorer/?path=@(file.RelativePath)" target="_self">
                                                    @(file.FileName)
                                                </a>
                                            }
                                            else
                                            {
                                                @(file.FileName)
                                            }
                                        </td>
                                        <td>@(file.LastAccessTime)</td>
                                        <td>@(file.LastWriteTime)</td>
                                        <td>
                                            @if (!file.IsDir)
                                            {
                                                @(file.Size)
                                            }
                                        </td>
                                        <td>
                                            <button class="btn btn-x">删除</button>
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    }
                    else
                    {
                        <div class="alert alert-danger">没有文件夹或者文件</div>
                    }
                </div>
            </div>
        </div>

    </div>


    <!-- footer page -->
    @Html.Partial(IncludePath("body_bottom"))
</body>
</html>
